package com.ruoyi.system.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.AssignNumberBegin;
import com.ruoyi.system.mapper.AssignNumberBeginMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/system/assignNumberBegin")
public class AssignNumberBeginController {
    @Autowired
    private AssignNumberBeginMapper assignNumberBeginMapper;

    @GetMapping("/get")
    public AjaxResult get() {
        AssignNumberBegin config = assignNumberBeginMapper.selectOne();
        return AjaxResult.success(config);
    }

    @PostMapping("/update")
    public AjaxResult update(@RequestBody AssignNumberBegin param) {
        AssignNumberBegin config = assignNumberBeginMapper.selectOne();
        if (config == null) {
            // 新增
            assignNumberBeginMapper.insert(param);
        } else {
            // 更新
            param.setId(config.getId());
            assignNumberBeginMapper.update(param);
        }
        return AjaxResult.success();
    }
} 